<link type="text/css" rel="stylesheet" href="http://www.12301.cc/tpl/new_tpl/credit_/css/credit.css" />
<script type="text/javascript" src="http://www.12301.cc/tpl/channels_confd/js/global.js"></script>
<link rel="stylesheet" href="http://www.12301.cc/css/common/www.12301.cc.global.css"/>
<style type="text/css">
.fund{display:none;background:white; left:50%;  border: 1px solid rgba(127, 124, 134, 0.4);  border-radius: 5px; margin-left:-195px; margin-top:-100px; position:absolute; top:50%; width:480px; height:322px;  z-index:100;}
.fund table{ margin-top:0px;  width: 100%;}
.fund table thead th{text-align:left;  background: #e5e5e5; padding:0 15px; height:40px; line-height:40px; font-size:1.4em;}
.fund table thead{ background-color:transparent; height:auto; border:0;}
.fund table thead th span{ cursor:pointer; display:inline-block; float:right; width:17px; height:17px; background:url(images/close.png) no-repeat; margin-top:12px;}
.fund table td{ height:auto; padding:15px; text-align:left;}
.fund table td p{font-weight:bold; text-align:left;height:30px; line-height:30px;}
.fund table td p font{margin:0 5px;}
.fund table td span{line-height:30px;}
.fund_s{float: left;width: 100%;  margin-top: 10px;}
.fund_m{float: left;width: 100%;height:30px;line-height:30px;}
.fund_h{float: left;width: 100%;}
.account_m{  float: left;display: inline-block;width: 80px;line-height: 32px;height: 43px;left: 0px;padding-left: 12px;}
.fund table td span.yuck {float: left;display: inline-block;width: 80px;line-height: 32px;height: 43px;left: 0px;padding-left: 7px;}
.fund table td span.yu {float: left;margin-left: 35px;}
#money_u{ height:18px; line-height:18px; padding:2px 4px; border:1px solid #CCCCCC; width:60px; margin:12px 4px 0;}
#money{height: 22px;line-height: 22px;float: left;width: 320px;}
#bei{ resize: none;width: 328px;height: 88px;margin-left: 16px;resize: none; padding:2px 4px; border:1px solid #CCCCCC;}
.fund table td span.qd{display: inline-block;width: 120px;height: 30px;margin-top: 20px;margin-left: 87px;margin-right: 10px;line-height: 30px;border: 0;font-size: 1.4em;
background-color: #F07845;text-align: center;font-weight: normal;  border-radius: 3px;color: #FFF;cursor: pointer;}
.fund table td span.qg{display: inline-block;width: 120px;height: 30px;margin-left: 55px;margin-right: 10px;line-height: 30px;border: 0;font-size: 1.4em;
background-color: #00a0e9;text-align: center;font-weight: normal;  border-radius: 3px;color: #FFF;cursor: pointer;}
.fund table td span.qd input:hover{ background:url(images/btn23bg22.png) repeat-x;}
.mc_title a{float:right; margin-right:50px; line-height:25px;}
.dismtab tbody td.txtlf{ text-align:left; padding-left:8px;}
#excel{width:80px;height:30px;float:right;border:none;background:#00AAD3;cursor:pointer;color:#FFF;}
#excel:hover{background:#03A2C9;}
/*遮罩*/
#Mask_div{z-index:1000;background-color:gray; opacity:0.5; position:absolute; top:0; z-index:9000; filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5; } 
#pop_refund{ background-color:#fff;border:1px solid rgba(127, 124, 134, 0.4);  height:270px; left:50%; margin:-200px 0 0 -200px; padding:0px; position:fixed !important; /* 浮动对话框 */ 
position:absolute; top:55%; width:480px; z-index:9999; border-radius:5px; display:none;text-align:center;  } 
.no_unline a{text-decoration:none;}
.no_unline a:hover{text-decoration:none;}
.refund_title{height:30px;line-height:30px;font-size:16px;text-align:left;padding-left:20px;  background: #e5e5e5;}
.delrefun{font-size:14px}
#PopWindow{ padding:20px; border:4px solid #bbb}
#PopWindow textarea{width:200px;}
#PopWindow .btn{ width:100px; height:25px; font-size:12px; cursor:pointer}
.td-medium{ width: 320px;}
.td-small{width: 230px;}
p.p_top{border-bottom:1px solid #D4E7FF;}
p .again{display:inline-block;width:180px;}
p .people{display:inline-block;}
p.re{position:relative;}
.print_t{cursor:pointer;}
#box_frm{width:100%;height:220px;margin:0 auto;}
#box_frm .sub_b {float: left;width: 100%;text-align: center;margin-top: 10px;border-top: 0px solid #e5e5e5;}
#box_frm #input_txt{width:320px;height:88px;margin-left: -38px;resize: none;border:0px solid #rgba(127, 124, 134, 0.4);}
.btn_submit{display: inline-block;width: 100px;margin-left: 34px;height: 30px;margin-top: 20px;margin-right: 10px;
line-height: 30px;border: 0;font-size: 1.4em;background-color: #00a0e9;text-align: center;font-weight: normal;
color: #FFF;cursor: pointer;}
.delrefund{display: inline-block;width: 100px;height: 30px;margin-top: 20px;  margin-left: 43px;margin-right: 10px;
line-height: 30px;border: 0;font-size: 1.4em;background-color: #F07845;text-align: center;font-weight: normal;
color: #FFF;cursor: pointer;}
.bei{  float:left;width: 97px;height:31px;line-height: 31px;overflow: hidden;white-space: nowrap; text-overflow: ellipsis;cursor:pointer;}
.fxsgl td.setBorder{border-right:0 none;}
span.pop_money {float: left;display: inline-block;width: 80px;line-height: 60px;height: 60px;left: 0px;padding-left: 7px;}
.formInp_ {padding: 5px 8px;background: #fff;
border: 1px solid #dbdbdb;border-radius: 3px;box-shadow: inset 0 1px 1px rgba(0,0,0,.075);-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);}
input.pop_mon_text.formInp_ {height: 22px;line-height: 22px;float: left;margin-top: 12px;width: 320px;}
.pop_s{float: left;width: 100%;}
.pop_f{float: left;width: 100%;}
span.pop_bei {float: left;margin-left: 46px;}

</style> 
<iframe name="ifr" style="display:none;"></iframe>
<div class="credit_active" data="<?=$var['rule']?>" aid="" dname="<?=$_SESSION['account']?>">
	<input type="hidden"  class="type" value=""/>
	<ul id="tabHead" class="tabHead clearfix">
        <li class="profit">授信/预存</li>
    </ul>
	<div class="credit_search">
		<div class="search_left">
			<span class="search_titile" time="" now="<?php echo date("Y-m-d");?>">时间：</span>
			<div class="search">
				<input class="formInp_a" id="search_t" value="<?=$var['beginDate']?>" type="text">
				<input class="formInp_b" id="search_d" value="<?=$var['endDate']?>" type="text">
				<i class="calendarBtn c1"></i>  
				<i class="calendarBtn c2"></i>
				<i class="calendarBtn_ c3">—</i>
			</div>
			<span class="save_btn" id="scope_btn">查询</span>
		</div>
		<div class="search_right">
			<div class="sera">
				<i class="up_tic"></i>
				<span class="up_title">导出数据</span>
			</div>
		</div>
	</div>
</div>
<div class="credit_ti">
	<div class="credit_title">
		<p class="credit_p"><span class="credit_cei"></span><span class="credit_sup"><?=$var['dname']?></span></p>
		<p class="credit_p">
			<span class="credit_cea">授信额度：</span> 
			<span class="credit_supa"><?=$var['credit2']?></span><span class="yuana">元</span>
			<span class="host_money oredr_pay" data-type="c">修改</span>
			<span class="credit_ceb">授信可用额度：</span>
			<span class="credit_supb"><?=$var['credit3']?></span><span class="yuan">元</span>
			<!-- <span class="credit_cec">交易合计：</span>
			<span class="credit_supc">51</span><span>元</span> -->
		</p>
		<a href="javascript:void(0)" onclick="setFund(65,this)" data_dname="<?=$var['dname']?>" data_account="<?=$var['account']?>" data_money="<?=$var['balance']?>" data_s="<?=$var['credit1']?>" class="credit_partner" data-type="t"></a>
	</div>
	<div class="pub_top_left" data_li="0" data_a="1"  data_b="2">
		<a href="javascript:void(0);" class="pub_normal nou">预存/还款记录</a>
		<a href="javascript:void(0);" class="pub_history">授信额度调整记录</a>
	</div>
	<div class="a">
		<table class="tb_card mli" id="mlistUl"  border="0" cellpadding="0" cellspacing="0"></table>
	</div>
	<div class="b">
		<table class="tb_card mli_a" id="mlistUl_a" border="0" cellpadding="0" cellspacing="0"></table>
	</div>
	
	<div class="pagenavW clearfix" id="pagenavW">		
		<div class="rt">
			<span id="total_num"></span>
			<span id="whichPage">第<span id="whichPageNum" style="margin:0 3px;"></span>页</span> 
			<span class="page_num">
				到
				<input type="text" class="page_num_ formI_" value="">
				页
				<span class="page_sub" data="">跳页</span> 
			</span>
			<a id="prevPageBtn" href="javascript:void(0)" data-first="" data-last=""  data-mid="" class="prevBtn btn pageBtn disable" style="margin-left:10px;">上一页</a>
			<a id="nextPageBtn" href="javascript:void(0)" class="nextBtn btn pageBtn">下一页</a>
		</div>
	</div>
</div>



<div id="fund" class="fund">
	<table class="dismtab">
		<thead>
			<th><span onclick="$('#fund').hide();$('#mask').hide();"></span><?if($dtype==7){echo "线下充值";}else{echo "分销还款/充值";}?> - <font id="info" color="green"><a target="_blank" class="info_url" href=""><?=$var['dname']?>（ID:<?=$var['account']?>）</a></font></th>
		</thead>
		<tbody>
			<tr>
				<td>
				  <form name="pay" action="call/setFund_n.php" target="ifr">
				  <!-- <form name="pay" action="admin/pppp.php" target="ifr">  -->
					<input type="hidden" name="did" id="did" />
				<?    if($dtype==7){?>
					<input type="hidden" name="act" id="act" value="z" />
					<span class="yuck">线下充值其资金账户<input type="text" name="tmoney" id="money" />元</span><br />
					<span class="qd"><input type="button" onclick="paytype(2)" value="确 认 充 值" /></span>
					<span class="qd"><input type="button" onclick="$('#fund').hide();$('#mask').hide();" value=" 取 消 " /></span>
				<?    }else{?>
					<input type="hidden" name="act" id="act" value="r" />
					<div class="fund_m">
						<span class="account_m">账户余额：</span>
						<font id="tmoney" color="green"><?=$var['balance']?></font>元</p>
					</div>
					<div class="fund_m">
						<span class="account_m">授信余额：</span>
						<font id="tmoney" color="green"><?=$var['credit1']?></font>元</p>
					</div>
					<div class="fund_s">
						<span class="yuck">预存/还款：</span>
						<input type="text" name="money" class="formInp_ fund_money"  autocomplete="OFF" id="money" />
					</div>
					<div class="fund_h">
						<span class="yu">备注：</span>
						<textarea name="memo" class="formInp_" id="bei" maxlength="200" ></textarea>
					</div>
					<span class="qd" onclick="paytype(0)" >使用账户余额</span>
					<span class="qg" id="ali" onclick="paytype(1)" >通过支付宝</span>
				<?    }?>
				  </form>
				</td>
			</tr>
		</tbody>
	</table>
</div>

<div id="pop_refund">
	<form id="box_frm">
		<h3 id="title_msg" class="refund_title">授信</h3>
		<div class="pop_f">
			<span class="pop_money">授信额度:</span>
			<input type="text" class="pop_mon_text formInp_"  autocomplete="OFF" onkeydown='if(event.keyCode==13) return false;' value="">
		</div>
		<div class="pop_s">
			<span class="pop_bei">备注:</span>
			<p><textarea id="input_txt" class="formInp_" name="other" ></textarea></p>
		</div>
		<div class="sub_b">
			
			<span class="btn delrefund" onclick="closeBg();"/>取消</span>
			<span class="btn btn_submit"/>提 交</span>
		</div>
	</form>
</div> 

<script type="text/javascript" src="http://www.12301.cc/js/WdatePicker.js"></script>
<script type="text/javascript" src="http://wx.12301.cc/public/js/common/class.js"></script>
<script type="text/javascript" src="http://wx.12301.cc/public/js/common/ajax.js"></script>

<script type="text/javascript" src="http://www.12301.cc/tpl/new_tpl/credit_/js/credit.js"></script>

<script>
window.onload = function(){  
	var pa = Number($(".credit_active").attr("data"));
	if(pa=="1"){
		$(".credit_cei").text("分销商：");
		$(".host_money").show();
		$(".credit_partner").text("线下预存");
		$(".credit_partner").addClass("xianxia");
		$(".credit_partner").attr("onclick",null);
	}else{
		$(".credit_cei").text("供应商：");
		$(".host_money").hide();
		$(".credit_partner").text("预存/还款充值");
		$(".credit_partner").removeClass("xianxia");
		$(".credit_partner").attr("onclick","setFund(65,this)");
	
	}
	//$("#mlistUl_a_wrapper").hide();
};
function setFund(id,a){
    $('#fund').show();
    $('#mask').show();
    // var td=$(a).parent().parent().children();
    // $("#info").html(td.eq(0).html());
    // $("#tmoney").html(td.eq(3).html());
    // $("#cmoney").val(td.eq(4).html());
    // $("#did").val(id);
    // $("#ali").val('通过支付宝');
}
$(".close").live("click",function(){
    $('#fund').hide();
    $('#mask').hide();
})
// $(".pub_history1").live("click",function(e){
	// var qQuery = new Query({container:$(".tb_card")});
	// var bt = $("#search_t").val();
	// var et = $("#search_d").val();
	// $("#mlistUl").hide();
	// $(".tcdPageCode_a").hide();
	// $(".tcdPageCode").show();
	// $(this).addClass("nou");
	// $(".pub_normal").removeClass("nou");
// })
// $(".pub_normal1").live("click",function(e){
	// var bt = $("#search_t").val();
	// var et = $("#search_d").val();
	// var qQuery = new Query({container:$(".tb_card")});
	// $(".pub_history").removeClass("nou");
	// $(".tcdPageCode").hide();
	// $(".tcdPageCode_a").show();
	// $(this).addClass("nou");
	// $(".pub_top_left").attr("data_li","0");
// })





$(".oredr_pay,.xianxia").live("click",function(){
	$(".pop_mon_text").val("");
	var daty_t = $(this).attr("data-type");
	$(".type").val(daty_t);
	if(daty_t=="t"){
		$(".refund_title").text("授信线下预存");
	}else{
		$(".refund_title").text("授信额度修改");
	}
	var bh = $("html").height();   
	var bw = $("html").width();      
	$("#mask").css({ height:bh, width:bw, display:"block" });
	$("#pop_refund").show(); 
	$("#input_txt").val(null);
})
$("#pop_refund").on('click', '.btn_submit', function(){
		var url = "call/setFund_n.php";
		var meno = $("#input_txt").val();
		var act= $(".type").val();
		var did =$(".credit_active").attr("aid");
		var pt =$(".credit_active").attr("dname");
		var money =$(".pop_mon_text").val();
		if(act=="c"){
			var postData ={
				act : act,
				did : did,
				pt : pt,
				cmoney :money,
				meno : meno
			}
		}else{
			var postData ={
				act : act,
				did : did,
				pt : pt,
				tmoney :money,
				meno : meno
			}
		}
		$.ajax({
			type:'POST',url: url,data: postData, dataType:'json',
			//type:'POST',url: 'http://www.12301.cc/admin/pppp.php',data: postData, dataType:'json',
		}).done(function(res) {
			if(res.status=="success"){
				PFT_GLOBAL.U.Alert("success",'<p style="width:120px">'+res.msg+'</p>');
				location.reload();
			}
			else{
				PFT_GLOBAL.U.Alert("fail",'<p style="width:120px">'+res.msg+'</p>');
			}
		})
		$("#mask,#pop_refund").hide();  
		$("#tmoney").val("");
		$("#cmoney").val("");
		
})

function paytype(t){
    if(!$("#money").val()){
        alert('请填写金额');
        return false;
    }
    var b=$("#ali");
    var f=document.forms["pay"];
    if(t==1){
        if(b.text()=="完成/重新支付"){
            window.location.reload();
            return false;
        }
        else{
            b.text("完成/重新支付");
        }
        f.target="_blank";
        f.action="recharge.php";
    }
    else if(t==0){
        f.target="ifr";
        f.action="call/setFund_n.php";
    }
    f.submit();
}




function closeBg() { 
    $("#mask,#pop_refund").hide(); 
} 
</script>





